home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
BBS in a Box 7
/
BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso
/
Files
/
Prog
/
T
/
TC Prog Guide.cpt
/
picture ƒ
/
ring.c
< prev
next >
Wrap
Text File
|
1990-11-08
|
1KB
|
63 lines
/*
* FILE: ring.c
* AUTHOR: R. Gonzalez
* CREATED: October 8, 1990
*
* defines methods for ring nested segment
*/
# include "ring.h"
# include "trans.h"
# include "cube.h"
# define NUM_CUBES 8
# define RADIUS 3.
# define CUBE_TYPE Fast_Cube
/******************************************************************
* initialize
******************************************************************/
boolean Ring::init(void)
{
int i;
Translation *transl;
Rotation_Y *roty;
Transformation *combination;
/* The following temp is needed due to a bug in Think C when
handling arrays of pointers, when the array is an instance var.
*/
Segment *temp_seg;
Nested_Segment::init();
transl = new(Translation);
transl->init();
transl->set(-.5,-.5,RADIUS-.5);
roty = new(Rotation_Y);
roty->init();
combination = new(Transformation);
combination->init();
num_segments = NUM_CUBES;
for (i=0 ; i<NUM_CUBES ; i++)
{
temp_seg = new(CUBE_TYPE);
segment[i] = temp_seg;
segment[i]->init();
roty->set(i*2.*PI/NUM_CUBES);
combination->combine(transl,roty);
segment[i]->move(combination);
}
transl->destroy();
delete(transl);
roty->destroy();
delete(roty);
combination->destroy();
delete(combination);
return TRUE;
}